/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.util.List;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class SearchCustomers extends AbstractAction
/*    */ {
/*    */   public SearchCustomers(AbstractHttpServlet servlet)
/*    */   {
/* 25 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 35 */     User user = super.getLoginUser(request);
/*    */ 
/* 37 */     String companyName = Util.getURLParameter(request
/* 38 */       .getParameter("companyName"));
/* 39 */     String tel = Util.getURLParameter(request.getParameter("tel"));
/* 40 */     String email = Util.getURLParameter(request.getParameter("email"));
/* 41 */     String qq = Util.getURLParameter(request.getParameter("qq"));
/*    */ 
/* 43 */     CustomerManager manager = new CustomerManager();
/* 44 */     response.setContentType("text/html;charset=utf-8");
/* 45 */     PrintWriter out = response.getWriter();
/* 46 */     JSONObject jsonObject = new JSONObject();
/*    */     try {
/* 48 */       List result = manager.search(user.companyId, 
/* 49 */         companyName, tel, email, qq);
/* 50 */       jsonObject.put("error", "0");
/* 51 */       jsonObject.put("customers", result);
/* 52 */       int num = 0;
/* 53 */       if ((result != null) && (result.size() > 0)) {
/* 54 */         num = result.size();
/*    */       }
/* 56 */       jsonObject.put("customersNum", Integer.valueOf(num));
/*    */     }
/*    */     catch (DBException localDBException) {
/*    */     }
/* 60 */     out.println(jsonObject);
/* 61 */     out.flush();
/* 62 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.SearchCustomers
 * JD-Core Version:    0.6.1
 */